package org.flashbrighton.as3bots.logic
{
	import org.flashbrighton.as3bots.events.BotEvent;
	import org.flashbrighton.as3bots.collision.CollidableType;

	public class cjbotlogic implements IBotLogic
	
	{
		private var _engineVal:Number;
		private var _rotateVal:Number;
		private var _mood:String;
		
		public function cjbotlogic()
		{
			_engineVal = 0.5;
			_rotateVal = 0;
			_mood = "good";
		}
		
		public function notify(event:BotEvent):void
		{
			if (event.collisionPoint > 0.5) {
			
				_mood = "bad";
			}
			else if (event.targetType == CollidableType.WALL)
			{
				_mood = "bad";
			}
			else{
				_mood = "good";
			}
			
		}
		
		public function run():void
		{
			if(_mood=="good"){
				_engineVal=1;
				_rotateVal= 0.5;
			}
			else if(_mood=="bad"){
				_engineVal=-1;
				
			}
		}
		
		public function get rotatorPercent():Number
		{ 
			return _rotateVal;
		}
		
		public function get enginePercent():Number
		{
			return _engineVal;
		}
		
	}
}